<template>
	<view class="content-box"> 
		<view class="back_btn_box" >
			<image src="../../static/px/left.png" style="width: 20rpx;position:fixed;" mode="widthFix" @click="back"></image> 
			 <view style="width: 300rpx;float: left;margin-top: -15rpx;margin-left: 30rpx;line-height: 60rpx;font-size: 35rpx;">
				{{examName}} 
			 </view>
		</view>
		<view style="width: 100%;float: left;margin-top: 140rpx;"></view>
		<view class="p_detail_item" v-for="(item,index) in dataList" :key="index" @click="detail(index)">
			<view class="title">
				{{item.topic}}
			</view> 
			<view class="status">
				<image v-if="item.isAnswer=='y'" src="../../static/training/over.png" style="width: 100rpx;float: right;" mode="widthFix"></image>
				<image v-else src="../../static/training/un_over.png" style="width: 100rpx;float: right;" mode="widthFix"></image>
			</view>
			<view class="m">
				<view v-if="item.qtype==1" class="type">
					单选
				</view>
				<view v-else-if="item.qtype==2" class="type">
					多选
				</view>
				<view v-else-if="item.qtype==3" class="type">
					判断
				</view>
				<view v-else-if="item.qtype==4" class="type">
					填空
				</view>
				<view v-else class="type">
					简答
				</view>
				<view v-if="item.difficulty=='简单'" class="lev">
					{{item.difficulty}}
				</view>
				<view v-if="item.difficulty=='一般'" class="lev1">
					{{item.difficulty}}
				</view>
				<view v-if="item.difficulty=='困难'" class="lev2">
					{{item.difficulty}}
				</view>
			</view>
			<view class="del">
				<view class="lab">{{item.analysis}}</view>
			</view>
			<view class="ck">
				<view style="float: left;">查看解析</view><image src="../../static/training/right_icon.png" style="width: 14rpx;float: left;margin-left: 10rpx;margin-top: 5rpx;" mode="widthFix"></image>
			</view>
			 
		</view>
		
		<view class="magin_top20"></view>  
	</view>

</template>

<script>
	import {
		myPracticeRecordsDetail
	} from "@/common/api/training/training.js";
	export default {
		data() {
			return {
				dataList:[],
				examName:'',
				id:''
			};
		},
		onLoad(query) {
			if(query.id){
				this.getList(query.id); 
				this.id=query.id
			} 
			if(query.examName){
				this.examName=query.examName
			}
		},
		methods: {
			back(){
				uni.navigateBack()
			},
			course(){
				uni.navigateTo({
					url:"/pages/training/course"
				})
			},
			topic(){
				uni.navigateTo({
					url:"/pages/training/topic"
				})
			},
			detail(index){
				uni.navigateTo({
					url: '/pages/training/practice_topic?id='+this.id+"&index="+index+"&name="+this.examName
				});
			},
			getList(id){
				myPracticeRecordsDetail({
					 "id":id
					}).then((res) => {
					if (res && res.code == 200 && res.data) { 
						this.dataList=res.data.questspra; 
					}
				}); 
			}
		},
	};
</script>

<style lang="scss" scoped>
	@import url("../../common/base.css");
	@import "./info.scss";

	page {
		background-image: url("../../static/bg.png");
		background-size: 100% 100%;
	}
</style>